home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDSFDR.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  6.4 KB  |  160 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdsfdr.rul                                                */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdSelectFolder        */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdSelectFolder                                             */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will let user choose which group/folder        */
  22.  /*             the software should belong to.                             */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. function SdSelectFolder( szTitle, szMsg, svDefGroup )
  27.           STRING  szDlg, szTemp, szGroup, szStr_InvalidFolder, szStr_InvalidFdr_Title;
  28.           NUMBER  nId, nMessage, nTemp, nOS, hIsres;
  29.           HWND    hwndDlg, hwndEdit;
  30.           BOOL    bDone;
  31.         begin
  32.  
  33.            Enable(HOURGLASS);
  34.            szDlg     = SD_DLG_SELECTFOLDER;
  35.            nSdDialog = SD_NDLG_SELECTFOLDER;
  36.  
  37.           // record data produced by this dialog
  38.           if (MODE=SILENTMODE) then
  39.             SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
  40.             SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  41.             if ((nId != BACK) && (nId != CANCEL)) then
  42.                SilentReadData( szAppKey, "szFolder", DATA_STRING, svDefGroup, nTemp );
  43.             endif;
  44.         Disable(HOURGLASS);
  45.             return nId;
  46.           endif;
  47.  
  48.  
  49.            // ensure general initialization is complete
  50.            if (!bSdInit) then
  51.               SdInit();
  52.            endif;
  53.  
  54.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_SELECTFOLDER ) = DLG_ERR) then
  55.            Disable(HOURGLASS);
  56.                return -1;
  57.            endif;
  58.  
  59.            // Loop in dialog until the user selects a standard button
  60.            bDone = FALSE;
  61.  
  62.            while (!bDone)
  63.  
  64.               nId = WaitOnDialog( szDlg );
  65.               switch(nId)
  66.               case DLG_INIT:
  67.                    if( szMsg != "" ) then
  68.                        SdSetStatic(szDlg, SD_STA_MSG, szMsg);
  69.                    endif;
  70.  
  71.                    szGroup = svDefGroup;
  72.  
  73.                    CtrlSetText( szDlg, SD_EDIT_PROGGRP, szGroup );
  74.                    CtrlPGroups( szDlg, SD_LIST_EXISTGRP );
  75.                    CtrlSetCurSel( szDlg, SD_LIST_EXISTGRP, szGroup );
  76.  
  77.                    hwndDlg = CmdGetHwndDlg( szDlg );
  78.                    SdGeneralInit( szDlg, hwndDlg, STYLE_BOLD, szSdProduct );
  79.  
  80.                    if(szTitle != "") then
  81.                        SetWindowText(hwndDlg, szTitle);
  82.                    endif;
  83.                    
  84.                    Disable(HOURGLASS);
  85.  
  86.               case SD_LIST_EXISTGRP:
  87.                    CtrlGetCurSel(szDlg, SD_LIST_EXISTGRP, szGroup );
  88.                    CtrlSetText(szDlg, SD_EDIT_PROGGRP, szGroup );
  89.  
  90.               case NEXT:
  91.                    CtrlGetText(szDlg, SD_EDIT_PROGGRP, szGroup );
  92.                    SdRemoveEndSpace( szGroup );
  93.  
  94.                    if (szGroup = "") then // don't allow null group names
  95.                      MessageBeep(0);
  96.                      hwndEdit = GetDlgItem( hwndDlg, SD_EDIT_PROGGRP );
  97.                      SetFocus( hwndEdit );
  98.              // don't allow illegal characters (\/:*?"<>|)
  99.                elseif ((szGroup % "/") ||
  100.                 (szGroup % ":") ||
  101.                 (szGroup % "*") ||
  102.                 (szGroup % "?") ||
  103.                 (szGroup % "\"") ||
  104.                 (szGroup % "<") ||
  105.                 (szGroup % ">") ||
  106.                 (szGroup % "|") && SdIsShellExplorer() ) then
  107.                 MessageBeep(0);
  108.                // Load String
  109.                hIsres = GetModuleHandle( ISRES );
  110.                if (hIsres) then
  111.                 LoadString( hIsres, SD_STR_INVALID_FOLDER_TITLE, szStr_InvalidFdr_Title, _MAX_STRING );
  112.                 LoadString( hIsres, SD_STR_INVALID_FOLDER, szStr_InvalidFolder, _MAX_STRING );
  113.                endif;
  114.                SetDialogTitle(DLG_MSG_SEVERE, szStr_InvalidFdr_Title);
  115.                MessageBox(szStr_InvalidFolder+ "\n\n\t            "+ "/ : * ? \" < > |", SEVERE);
  116.                SetDialogTitle(DLG_MSG_SEVERE, "Severe");
  117.                hwndEdit = GetDlgItem( hwndDlg, SD_EDIT_PROGGRP );
  118.                      SetFocus( hwndEdit );
  119.                    else
  120.                      svDefGroup = szGroup;
  121.                      nId        = NEXT;
  122.                      bDone      = TRUE;
  123.                    endif;
  124.  
  125.               case BACK:
  126.                    nId    = BACK;
  127.                    bDone  = TRUE;
  128.  
  129.               case DLG_ERR:
  130.                    SdError( -1, "SdSelectFolder" );
  131.                    nId    = -1;
  132.                    bDone  = TRUE;
  133.  
  134.               case DLG_CLOSE:
  135.                    SdCloseDlg( hwndDlg, nId, bDone );
  136.  
  137.               default:
  138.                    // check standard handling
  139.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  140.                       bDone = TRUE;
  141.                    endif;
  142.               endswitch;
  143.  
  144.            endwhile;
  145.  
  146.            EndDialog( szDlg );
  147.            ReleaseDialog( szDlg );
  148.  
  149.            SdUnInit( );
  150.            Disable(HOURGLASS);
  151.  
  152.            // record data produced by this dialog
  153.            SdMakeName( szAppKey, szDlg, szTitle, nSdSelectFolder );
  154.            SilentWriteData( szAppKey, "szFolder", DATA_STRING, svDefGroup, 0 );
  155.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  156.  
  157.            return nId;
  158.  
  159.         end;
  160.